import store from './store'
import {addGoods} from './store/slice/goodsSlice'
import {addCar} from './store/slice/carSlice'

// 监听仓库
store.subscribe(() => {
    console.log(store.getState());
})

// 添加商品
store.dispatch(addGoods({ gname: '小米手机', price: 3999 }))
store.dispatch(addGoods({ gname: '华为手机', price: 9 }))


// 添加购物车
store.dispatch(addCar(store.getState().goods.goodsList[0]))
store.dispatch(addCar(store.getState().goods.goodsList[0]))
store.dispatch(addCar(store.getState().goods.goodsList[1]))